<?php
//模块插件类
//插件功能类，由系统调用，实现具体功能。
defined('BY_JYA') or exit('error');
class core_jy_move_car extends plugin{
	public function qr_scan($params){
		$card=pdo_get('jy_move_car_cards',array('id'=>intval($params['data'])));
		$setting=$this->plugin_setting('card');
		if(!$card['mid']){
			//未绑卡
			$news=array('title'=>'您好，绑定挪车卡，点击开始绑定！','description'=>'','url'=>custom_url('jy_move_car/move//code='.$card['code'],true),'picurl'=>$setting['bind_pic']);
		}else{
			//通知挪车
			if($_SESSION['uid']){
				if($card['mid']==$_SESSION['uid']){
					cfc('account')->send_text('调皮，你是要自己通知自己挪车吗？');
					return;
				}
			}
			$this->scan_log($card['number']);
			$member=$this->get('member',array('mid'=>$card['mid']));
			$member['plate']=json_decode($member['plate'],true);
			$member['plate']="{$member['plate']['p']}{$member['plate']['c']}{$member['plate']['number']}";
			$news=array('title'=>"您好，我是{$member['plate']}车主",'description'=>'临时停车，给您带来不便尽请谅解！点击呼叫我挪车！','url'=>custom_url('jy_move_car/move//code='.$card['code'],true),'picurl'=>$setting['move_pic']);
		}
		cfc('account')->send_news($news);
		return true;
	}
}
?>